﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using FCNS.Data.Table;

namespace DoubleH.Configuration
{
    public  class AppConfig
    {
        int delayTime = 1000;
        /// <summary>
        /// 数据库搜索的延迟时间
        /// </summary>
        public int DelayTime
        {
            get { return delayTime; }
            set { delayTime = value; }
        }

        string ln = string.Empty;
        /// <summary>
        /// 最后登录的用户名
        /// </summary>
        public string LastName
        {
            get { return ln; }
            set { ln = value.Trim(); }
        }

        string st = FCNS.Data.DataType.SQLITE.ToString();
        public string DataFlag
        {
            get { return st; }
            set { st = value.Trim(); }
        }

        private List<DataConfig> m_aceColumns = new List<DataConfig>();
        /// <summary>
        /// 数据库列表
        /// </summary>
        [XmlArray("DataConfig")]
        public List<DataConfig> DataConfigItems
        {
            get { return m_aceColumns; }
            set
            {
                if (value == null)
                    throw new ArgumentNullException("value");

                m_aceColumns = value;
            }
        }

        #region POS
        string posNO = string.Empty;
        /// <summary>
        /// pos 机器号
        /// </summary>
        public string PosNO { get { return posNO; } set { posNO = value; } }

        bool singleMode = false;
        /// <summary>
        ///  pos 必须联机销售
        /// </summary>
        public bool SingleMode { get { return singleMode; } set { singleMode = value; } }

        bool fullScreen = true;
        /// <summary>
        ///  pos 全屏模式
        /// </summary>
        public bool FullScreen { get { return fullScreen; } set { fullScreen = value; } }
        #endregion
    }

    public class DataConfig
    {
        string flag = string.Empty;
        public string Flag
        {
            get { return flag; }
            set { flag = value; }
        }

        string st = FCNS.Data.DataType.SQLITE.ToString();
        public string DataType
        {
            get { return st; }
            set { st = value.Trim(); }
        }

        string na = FCNS.Data.DbDefine.dbFile;
        public string DataName
        {
            get { return na; }
            set { na = value.Trim(); }
        }

        string mi = string.Empty;
        public string DataAddress
        {
            get { return mi; }
            set { mi = value.Trim(); }
        }

        string mu = string.Empty;
        public string DataUser
        {
            get { return mu; }
            set { mu = value.Trim(); }
        }

        string mp = string.Empty;
        public string DataPassword
        {
            get { return mp; }
            set { mp = value; }
        }
    }
}
